package com.bawei.bydayzg_two.adapter

import com.bawei.base.room.MessageEntity
import com.bawei.bydayzg_two.R
import com.bawei.bydayzg_two.Utils.GildUtils
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class MsgAdapter:BaseQuickAdapter<MessageEntity,BaseViewHolder>(R.layout.item_message) {
    override fun convert(holder: BaseViewHolder, item: MessageEntity) {
        holder.setText(R.id.msg_msg,item.userId)
        holder.setText(R.id.msg_time,item.time)
        holder.setText(R.id.msg_msg,item.userIcon)
        //
        if (item.image1 != ""){
            item.image1?.let { GildUtils.loadImg(context, it,holder.getView(R.id.msg_img1)) }
        }

        if (item.image2 != ""){
            item.image2?.let { GildUtils.loadImg(context, it,holder.getView(R.id.msg_img2)) }
        }

        if (item.image3 != ""){
            item.image3?.let { GildUtils.loadImg(context, it,holder.getView(R.id.msg_img3)) }
        }
    }
}